
<h1><span class="yiyi-st" id="yiyi-12">numpy.vsplit</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.vsplit.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.vsplit.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.vsplit"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.</code><code class="descname">vsplit</code><span class="sig-paren">(</span><em>ary</em>, <em>indices_or_sections</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/lib/shape_base.py#L566-L615"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">垂直（行方向）将数组拆分成多个子数组。</span></p>
<p><span class="yiyi-st" id="yiyi-15">请参阅<code class="docutils literal"><span class="pre">split</span></code>文档。</span><span class="yiyi-st" id="yiyi-16"><code class="docutils literal"><span class="pre">vsplit</span></code>与<em class="xref py py-obj">axis = 0</em>（默认）等效于<code class="docutils literal"><span class="pre">split</span></code>，数组始终沿第一轴分割，</span></p>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-17">也可以看看</span></p>
<dl class="last docutils">
<dt><span class="yiyi-st" id="yiyi-18"><a class="reference internal" href="numpy.split.html#numpy.split" title="numpy.split"><code class="xref py py-obj docutils literal"><span class="pre">split</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-19">将数组拆分为多个大小相等的子数组。</span></dd>
</dl>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-20">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">16.0</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span>
<span class="go">array([[  0.,   1.,   2.,   3.],</span>
<span class="go">       [  4.,   5.,   6.,   7.],</span>
<span class="go">       [  8.,   9.,  10.,  11.],</span>
<span class="go">       [ 12.,  13.,  14.,  15.]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">vsplit</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">[array([[ 0.,  1.,  2.,  3.],</span>
<span class="go">       [ 4.,  5.,  6.,  7.]]),</span>
<span class="go"> array([[  8.,   9.,  10.,  11.],</span>
<span class="go">       [ 12.,  13.,  14.,  15.]])]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">vsplit</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">]))</span>
<span class="go">[array([[  0.,   1.,   2.,   3.],</span>
<span class="go">       [  4.,   5.,   6.,   7.],</span>
<span class="go">       [  8.,   9.,  10.,  11.]]),</span>
<span class="go"> array([[ 12.,  13.,  14.,  15.]]),</span>
<span class="go"> array([], dtype=float64)]</span>
</pre></div>
</div>
<p><span class="yiyi-st" id="yiyi-21">使用较高维数组，分割仍沿着第一轴。</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">8.0</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span>
<span class="go">array([[[ 0.,  1.],</span>
<span class="go">        [ 2.,  3.]],</span>
<span class="go">       [[ 4.,  5.],</span>
<span class="go">        [ 6.,  7.]]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">np</span><span class="o">.</span><span class="n">vsplit</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">[array([[[ 0.,  1.],</span>
<span class="go">        [ 2.,  3.]]]),</span>
<span class="go"> array([[[ 4.,  5.],</span>
<span class="go">        [ 6.,  7.]]])]</span>
</pre></div>
</div>
</dd></dl>
